<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 有 54 张牌，请模拟⽃地主发牌给三个⼈，底牌留三张 -->
    <script>
        var pla = [
            '红桃A', '红桃2', '红桃3', '红桃4', '红桃5', '红桃6', '红桃7', '红桃8', '红桃9', '红桃10', '红桃J', '红桃Q', '红桃K',
            '黑桃A', '黑桃2', '黑桃3', '黑桃4', '黑桃5', '黑桃6', '黑桃7', '黑桃8', '黑桃9', '黑桃10', '黑桃J', '黑桃Q', '黑桃K',
            '梅花A', '梅花2', '梅花3', '梅花4', '梅花5', '梅花6', '梅花7', '梅花8', '梅花9', '梅花10', '梅花J', '梅花Q', '梅花K',
            '方片A', '方片2', '方片3', '方片4', '方片5', '方片6', '方片7', '方片8', '方片9', '方片10', '方片J', '方片Q', '方片K',
            '大王', '小王'
        ]
        function shuffle(pla) {
            for (var i = pla.length - 1; i > 0; i--) {
                const randomIndex = Math.floor(Math.random() * (i + 1));
                [pla[i], pla[randomIndex]] = [pla[randomIndex], pla[i]];
            }
            return pla;
        }
        var cards = shuffle(pla);
        var playA = cards.slice(0, 17);
        var playB = cards.slice(17, 34);
        var playC = cards.slice(34, 51);
        var Dipla = cards.slice(51, 54);
        console.log('玩家A:  ' + playA);
        console.log('玩家B:  ' + playB);
        console.log('玩家C:  ' + playC);
        console.log('底牌:  ' + Dipla);
    </script>
</body>

</html>